<template>
  <el-container>
    <el-header>
      <h2>语音识别</h2>
    </el-header>
    <el-main>
      <el-form :model="form" label-width="150px">
        <el-form-item label="音频输入">
          <el-switch v-model="form.audioInput" />
        </el-form-item>

        <el-form-item label="音频格式">
          <el-radio-group v-model="form.audioFormat">
            <el-radio label="MP3">MP3</el-radio>
            <el-radio label="WAV">WAV</el-radio>
            <el-radio label="OGG">OGG</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="采样率">
          <el-radio-group v-model="form.sampleRate">
            <el-radio label="16kHz">16kHz</el-radio>
            <el-radio label="24kHz">24kHz</el-radio>
            <el-radio label="44.1kHz">44.1kHz</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="比特率">
          <el-radio-group v-model="form.bitrate">
            <el-radio label="128kbps">128kbps</el-radio>
            <el-radio label="192kbps">192kbps</el-radio>
            <el-radio label="256kbps">256kbps</el-radio>
            <el-radio label="512kbps">512kbps</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="语言模型">
          <el-radio-group v-model="form.languageModel">
            <el-radio label="中文">中文</el-radio>
            <el-radio label="英语">英语</el-radio>
            <el-radio label="法语">法语</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="方言支持">
          <el-switch v-model="form.dialectSupport" />
        </el-form-item>

        <el-form-item label="识别精度控制（%）">
          <el-input v-model="form.recognitionAccuracy" type="number" />
        </el-form-item>

        <el-form-item label="连续语音识别">
          <el-switch v-model="form.continuousRecognition" />
        </el-form-item>

        <el-form-item label="模糊匹配（%）">
          <el-input v-model="form.fuzzyMatching" type="number" />
        </el-form-item>

        <el-form-item label="背景噪音抑制">
          <el-switch v-model="form.backgroundNoiseSuppression" />
        </el-form-item>

        <el-form-item label="延迟控制（ms）">
          <el-input v-model="form.delayControl" type="number" />
        </el-form-item>

        <el-form-item label="识别错误反馈">
          <el-switch v-model="form.errorFeedback" />
        </el-form-item>

        <el-form-item label="重试机制">
          <el-input v-model="form.retryMechanism" type="number" />
        </el-form-item>

        <el-form-item label="用户偏好记忆">
          <el-switch v-model="form.userPreferenceMemory" />
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="save">保存</el-button>
          <el-button @click="cancel">取消</el-button>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>

<script>
import { ElMessage } from "element-plus";
export default {
  data() {
    return {
      form: {
        audioInput: true,
        audioFormat: "MP3",
        sampleRate: "16kHz",
        bitrate: "128kbps",
        languageModel: "中文",
        dialectSupport: true,
        recognitionAccuracy: 90,
        continuousRecognition: true,
        fuzzyMatching: 80,
        backgroundNoiseSuppression: true,
        delayControl: 5000,
        errorFeedback: true,
        retryMechanism: 5,
        userPreferenceMemory: true
      }
    };
  },
  methods: {
    save() {
      // 保存逻辑
      console.log("保存:", this.form);
      ElMessage({
        message: "保存成功",
        type: "success"
      });
      // 这里可以添加 API 调用
    },
    cancel() {
      // 取消逻辑
      console.log("取消操作");
      // 可以重置表单或返回上一个页面
    }
  }
};
</script>

<style scoped>
.el-header {
  padding: 20px;
  text-align: center;
  background-color: #f5f7fa;
}
</style>
